package com.core.transtemare.enums;

public enum Terminal {

	TCP("TCP", 1), MONTECON("Montecon", 2);

	private int code;
	private String value;

	private Terminal(String value, int code) {
		this.code = code;
		this.value = value;
	}

	public int getCode() {
		return code;
	}

	public String getValue() {
		return value;
	}

	public static Terminal getByValue(String value) {
		for (Terminal terminal : values()) {
			if (terminal.getValue().equals(value)) {
				return terminal;
			}
		}
		return null;
	}

	public static Terminal getByCode(int code) {
		for (Terminal terminal : values()) {
			if (terminal.getCode() == code) {
				return terminal;
			}
		}
		return null;
	}

}
